import request from '@/request/request'

/* 获取员工列表的接口 */
export const getEmployessListAPI = (params) => {
  return request({
    url: '/sys/user',
    method: 'GET',
    params
  })
}

/* 新增员工的接口 */
export const addEmployessAPI = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

/* 删除员工的接口 */
export const deleteEmployessAPI = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'DELETE'
  })
}

/* 批量导入员工的接口 */
export const importExcelAPI = (data) => {
  return request({
    url: '/sys/user/batch',
    method: 'POST',
    data
  })
}

/* 获取员工基本信息的接口*/
export const getUserInfoAPI = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'GET'
  })
}

/* 保存员工基本信息的接口 */
export const updateEmployessInfoAPI = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}

/* 获取所有角色列表的接口  */
export const getRoleListAPI = () => {
  return request({
    url:'/sys/role',
    method:'GET'
  })
}

/* 分工分配角色的接口 */
export const assignRolesAPI = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}
